﻿<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage/MasterExpert.master" AutoEventWireup="true" CodeFile="RequestDevice.aspx.cs" Inherits="ExpertUsers_RequestDevice" %>

<asp:Content ID="Content1" ContentPlaceHolderID="Header1" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
     <div style="background-color:#FF9933; direction:rtl;padding-bottom:20px;padding-top:10px;border:1px solid #ccc;box-shadow: 0px 1px 1px rgba(0, 0, 0, 0.075) inset;border-radius: 4px;">
        <div style="padding-right:385px; width:100%">
        <asp:Image ID="Image2" runat="server" 
                        ImageUrl="~/Images/checklist.png" Width="17%"  />
        </div>
     
      
        <div style="width:93%;margin:auto;background-color:#FFE1A4; border:1px solid #ccc;box-shadow: 0px 1px 1px rgba(0, 0, 0, 0.075) inset;border-radius: 7px;">
       
        <div style="background-color:#FFCC66; border-radius: 7px;text-align:center;height:30px">
         <asp:Label ID="Label12" runat="server" Font-Size="14px" ForeColor="#0066CC" 
                    Text="درخواست کالا "></asp:Label>
        </div>
          <div >
    <table style="width: 100%;direction:rtl">
        <tr>
            <td colspan="4" >
            <br />
             <div style="border: 1px solid #FF9900;border-radius:3px;box-shadow: 0px 0px 10px rgba(189, 189, 189, 0.4);padding :10px;width:98%;margin:auto; background-color: FC6;">
                <div  class="headerTable" >
                <div style="width:10%;float:right">
                    <asp:Image ID="Image1" runat="server" src="../Images/ava_default_1.jpg" Height="40px" />
                </div>
                <div style="width:50%;float:right">
                    <h3><asp:Label ID="Label7" runat="server" Text="لیست وظایف تعیین شده" ForeColor="#E87400"></asp:Label></h3>
                </div>
                </div>
                <div>
                <asp:GridView ID="GwListTask" runat="server" AutoGenerateColumns="False" 
            BackColor="#DEBA84" BorderColor="#DEBA84" BorderStyle="None" BorderWidth="1px" 
            CellPadding="3" CellSpacing="2" DataSourceID="SqlExpertTask" Width="100%" 
              DataKeyNames="ID" onrowcommand="GwListTask_RowCommand"  AllowSorting="true">
            <Columns>
                <asp:BoundField DataField="ID" HeaderText="شماره درخواست مشتری" />
                <asp:BoundField DataField="Name" HeaderText="نام مشتری" SortExpression="Name" />
                <asp:BoundField DataField="Family" HeaderText="نام خانوادگی" 
                    SortExpression="Family" />
                <asp:BoundField DataField="Address" HeaderText="آدرس" 
                    SortExpression="Address" />
                <asp:BoundField DataField="Area" HeaderText="Area" SortExpression="Area" 
                    Visible="False" />
                <asp:BoundField DataField="Mobile" HeaderText="شماره موبایل" 
                    SortExpression="Mobile" />
                <asp:BoundField DataField="Telephone" HeaderText="شماره تلفن" 
                    SortExpression="Telephone" />
                <asp:BoundField DataField="RegDate" HeaderText="تاریخ ثبت درخواست" 
                    SortExpression="RegDate" />
                <asp:BoundField DataField="Description" HeaderText="توضیحات" 
                    SortExpression="Description" />
                <asp:BoundField DataField="Type" HeaderText="نوع مشکل" 
                    SortExpression="Type" />
                <asp:BoundField DataField="ExpertId" HeaderText="ExpertId" 
                    SortExpression="ExpertId" Visible="False" />
                <asp:TemplateField>
                        <ItemTemplate>
                        <asp:LinkButton ID="LinkButton1" CausesValidation="false" CommandName="RequestDevice" CommandArgument='<%#Eval("Id")%>' Text="درخواست کالا" runat="server"></asp:LinkButton>
                        </ItemTemplate>
                  </asp:TemplateField>

            </Columns>
            <FooterStyle BackColor="#F7DFB5" ForeColor="#8C4510" />
            <HeaderStyle BackColor="#A55129" Font-Bold="True" ForeColor="White" />
            <PagerStyle ForeColor="#8C4510" HorizontalAlign="Center" />
            <RowStyle BackColor="#FFF7E7" ForeColor="#8C4510" />
            <SelectedRowStyle BackColor="#738A9C" Font-Bold="True" ForeColor="White" />
            <SortedAscendingCellStyle BackColor="#FFF1D4" />
            <SortedAscendingHeaderStyle BackColor="#B95C30" />
            <SortedDescendingCellStyle BackColor="#F1E5CE" />
            <SortedDescendingHeaderStyle BackColor="#93451F" />
        </asp:GridView>
        </div>
        </div>
            </td>
           
        </tr>
        <tr >
            <td colspan="3">
            <br />
            <br />
            <br />
            <br />
                <asp:Panel ID="PnlRequestDevice" runat="server" Visible="false">
                <table style="direction:rtl;margin:auto; border-bottom-style: double; border-bottom-color: #E49218;">
                <tr>
                <td colspan="5" bgcolor="#E49218" align="center">
                    <asp:Label ID="Label5" runat="server" Text="درخواست کالا" ForeColor="#FFFFCC" 
                        Font-Bold="True"></asp:Label>
                </td>
                </tr>
                    <tr>
                    <td>
                        <asp:Label ID="Label6" runat="server" Text="شماره درخواست مشتری"></asp:Label>&nbsp; &nbsp;
                    </td>
                        <td>
                            <asp:Label ID="Label1" runat="server" Text="نام کالا"></asp:Label>
                        </td>
                        <td>
                            <asp:Label ID="Label2" runat="server" Text="تعداد"></asp:Label>
                        </td>
                        <td>
                            <asp:Label ID="Label3" runat="server" Text="تاریخ"></asp:Label>
                        </td>
                        <td>
                        </td>
                    </tr>
                <tr>
                <td>
                    <asp:Label ID="lblNumCust" runat="server" Text=""></asp:Label>
                </td>
                <td>
                    <asp:DropDownList ID="DrDevice" runat="server" DataSourceID="SqlDDevice" DataTextField="Name"  DataValueField="Id">
                    </asp:DropDownList>
                    <asp:SqlDataSource ID="SqlDDevice" runat="server" ProviderName="System.Data.SqlClient"
                     SelectCommand="SELECT [Id],[Name] FROM [TblDevice]" ConnectionString="<%$ ConnectionStrings:CON %>" ></asp:SqlDataSource>
                </td>
                <td>
                    <asp:TextBox ID="txtCount" runat="server" TextMode="Number" ToolTip="تعداد"></asp:TextBox>
                    <asp:RequiredFieldValidator
                        ID="RequiredFieldValidator1" runat="server" ErrorMessage="*" 
                        ControlToValidate="txtCount" ForeColor="Red"></asp:RequiredFieldValidator>
                </td>
                <td>
                    <asp:TextBox ID="txtTime" runat="server"></asp:TextBox>

                </td>
                <td>    

                    <asp:Button ID="btnInsert" runat="server" Text="ثبت" 
                        onclick="btnInsert_Click" Width="110px" />
                    <br />

                </td>
                </tr>
                <tr>
                    <td colspan="6" align="center">
                        
                            
                        <asp:Label ID="lblmessage" runat="server" Text=""></asp:Label>
                        
                            
                    </td>
                </tr>
                </table>
                </asp:Panel>
            </td>
            <td>
            <br />
            <br />
            <br />
            <br />
            <br />
            <br />
            </td>
            </tr>
        <tr align="center">
        <td colspan="2" bgcolor="#E49218">
            <asp:Label ID="Label4" runat="server" Text="لیست کالاهای درخواستی امروز" 
                ForeColor="#FFFFCC" Font-Bold="True"></asp:Label>
        </td>
        </tr>
        <tr>

            <td colspan="3">

              <asp:GridView ID="GwRequestDevice" runat="server" AutoGenerateColumns="False" 
            BackColor="#DEBA84" BorderColor="#DEBA84" BorderStyle="None" BorderWidth="1px" 
            CellPadding="3" CellSpacing="2"  Width="100%"  DataSourceID="SdRequseDevice" DataKeyNames="Id"
                    onrowcommand="GwRequestDevice_RowCommand" AllowSorting="true" >
            <Columns>
                <asp:BoundField DataField="Id" HeaderText="شماره درخواست کالا " SortExpression="Serial" />
                <asp:BoundField DataField="Serial" HeaderText="سریال کالا" SortExpression="Serial" />
                <asp:BoundField DataField="Name" HeaderText="نام کالا " 
                    SortExpression="Name" />
                <asp:BoundField DataField="CustFolderId" HeaderText=" شماره درخواست مشتری"  
                    SortExpression="CustFolderId" />
              
                <asp:TemplateField>
                        <ItemTemplate>
                        <asp:LinkButton ID="LinkButton1" CausesValidation="false" CommandName="DeleteRequest" OnClientClick="if (!confirm('آیا از حذف درخواست کالا مطمنید؟')) return false;" CommandArgument='<%#Eval("ReposDetailsId")%>' Text="حذف درخواست " runat="server"></asp:LinkButton>
           
                        </ItemTemplate>
                  </asp:TemplateField>

            </Columns>
            <FooterStyle BackColor="#F7DFB5" ForeColor="#8C4510" />
            <HeaderStyle BackColor="#A55129" Font-Bold="True" ForeColor="White" />
            <PagerStyle ForeColor="#8C4510" HorizontalAlign="Center" />
            <RowStyle BackColor="#FFF7E7" ForeColor="#8C4510" />
            <SelectedRowStyle BackColor="#738A9C" Font-Bold="True" ForeColor="White" />
            <SortedAscendingCellStyle BackColor="#FFF1D4" />
            <SortedAscendingHeaderStyle BackColor="#B95C30" />
            <SortedDescendingCellStyle BackColor="#F1E5CE" />
            <SortedDescendingHeaderStyle BackColor="#93451F" />
        </asp:GridView>
        <asp:SqlDataSource ID="SdRequseDevice" runat="server" 
                                ConnectionString="<%$ ConnectionStrings:CON %>" 
                                ProviderName="System.Data.SqlClient" 
            
                                SelectCommand="SELECT TblDeviceExpert.[CustFolderId],TblDeviceExpert.[Id],TblDeviceExpert.[ReposDetailsId],TblDeviceExpert.[DateRequest],TblRepository.[Id],TblRepository.[DeviceId],TblReposDetail.[IdRepos],TblReposDetail.[serial],TblDevice.[Id],TblDevice.[Name]   FROM [TblDeviceExpert] JOIN [TblReposDetail] ON(TblReposDetail.[Id]=TblDeviceExpert.[ReposDetailsId]) JOIN [TblRepository] ON(TblRepository.[Id]=TblReposDetail.[IdRepos])Join [TblDevice] ON (TblRepository.[DeviceId]=TblDevice.[Id]) WHERE (([ExpertId] = @ExpertId) And (DATEADD(dd, 0, DATEDIFF(dd, 0,TblDeviceExpert.[DateRequest])) =@Date))  ">
                                <SelectParameters>
                                    <asp:SessionParameter Name="ExpertId" SessionField="ExId" Type="Int32" />
                                    <asp:SessionParameter Name="Date" SessionField="DateToday" Type="String" />
                                </SelectParameters>
                            </asp:SqlDataSource>
                            
            </td>
        </tr>
        <tr>
        <td colspan="3">
            <asp:Label ID="Lblmessage2" runat="server" Text=""></asp:Label>
         </td>
        </tr>
    </table>
    <br />
    <br />
    <br />
    </div>
    </div>
        <asp:SqlDataSource ID="SqlExpertTask" runat="server" 
            ConnectionString="<%$ ConnectionStrings:CON %>" 
            ProviderName="System.Data.SqlClient" 
            
            SelectCommand="SELECT [Name], [Family], [Address], [Mobile], [Telephone], [RegDate],[Description], [ExpertId],[IsDone],[Type], [ID] FROM [CustCustFolder] WHERE ([ExpertId] = @ExpertId) AND [ISDone]=0">
            <SelectParameters>
                <asp:SessionParameter Name="ExpertId" SessionField="ExId" Type="Int32" />
            </SelectParameters>
        </asp:SqlDataSource>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="Header" Runat="Server">
</asp:Content>

